<?php 
session_start();
$page = "member-home";
include('checkLoggedIn.php');
include("config.php");
$my_alerts = UserAlertRel::getUserAlerts($_SESSION['userdata']['user_id']);
/*foreach($my_alerts as $alert){
	echo $alert['alert_name']." - ". $alert['Alerts']['AlertTypes']['alert_type']." - ".
	$alert['Alerts']['StopTimes']['Stops']['stop_name']." - ". 
	date('g:i a',strtotime($alert['Alerts']['StopTimes']['arrival_time']))." - ". 
	$alert['Alerts']['alert_time_offset']."<br>";
}*/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta name="viewport" content="width=320, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Saved Alerts</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.odd {
	background-color: #D7EBFF;
}
</style>
</head>

<body>
<div id="body-wrapper">
	<div id="header">
		<?php include('menu.php');?>
	</div>
	<div id="Content">
		<h2>Saved Alerts</h2>
		<?php foreach ($my_alerts as $alert){
		$name = $alert['alert_name'];
		$type = $alert['Alerts']['AlertTypes']['alert_type'];
		$stop = $alert['Alerts']['StopTimes']['Stops']['stop_name'];
		$time = date('g:i a',strtotime($alert['Alerts']['StopTimes']['arrival_time']));
		$offset = $alert['Alerts']['alert_time_offset'];
	?>
		<div class="trip odd">
		<div class="row trip-name"><?php  echo $name;?>	</div>
			<span class="start">stop name:</span>
			<span class="address"><?php echo $stop; ?></span><br>
			<span class="end">arrives at:</span>
			<span class="address"><?php echo $time; ?></span><br>
			<span class="start">alert time:</span>
			<span class="address"><?php echo $offset; ?> &nbsp;mins earlier </span><br>
			<span class="end">alert by:</span>
			<span class="address"><?php echo $type; ?></span>
		</div><?php  }?>
		<div class="clear"></div>
		
	</div>
</div>
</body>
</html>